/**
 * Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.xs_writer.entity;

import com.jeeplus.common.utils.SpringContextHolder;
import com.jeeplus.modules.sys.entity.User;
import com.jeeplus.modules.sys.mapper.UserMapper;
import com.jeeplus.modules.xs_user.entity.XsUser;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.google.common.collect.Lists;

import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.modules.xs_writer.mapper.XsWriterMapper;
import lombok.Data;

/**
 * 作家信息Entity
 * @author 天竹子
 * @version 2021-07-15
 */
@Data
public class XsWriter extends DataEntity<XsWriter> {
	
	private static final long serialVersionUID = 1L;
	@ExcelField(title="用户名称", fieldType=XsUser.class, value="user.nickname", align=2, sort=1)
	private XsUser user;		// 用户名称
	@ExcelField(title="笔名", align=2, sort=2)
	private String penName;		// 笔名
	@ExcelField(title="真实姓名", align=2, sort=3)
	private String name;		// 真实姓名
	@ExcelField(title="性别(1.男2.女)", dictType="sex", align=2, sort=4)
	private String sex;		// 性别(1.男2.女)
	@ExcelField(title="身份证号", align=2, sort=5)
	private String idNumber;		// 身份证号
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="出生日期", align=2, sort=6)
	private Date birthDate;		// 出生日期
	@ExcelField(title="QQ号", align=2, sort=7)
	private String qq;		// QQ号
	@ExcelField(title="联系电话", align=2, sort=8)
	private String phone;		// 联系电话
	@ExcelField(title="地址", align=2, sort=9)
	private String address;		// 地址
	@ExcelField(title="简介", align=2, sort=10)
	private String introduction;		// 简介
	@ExcelField(title="身份(1.童生2.秀才3.举人4.进士5.大学士6.大儒7.儒圣8.圣师)", dictType="identity", align=2, sort=11)
	private String identity;		// 身份(1.童生2.秀才3.举人4.进士5.大学士6.大儒7.儒圣8.圣师)
	@ExcelField(title="是否通过(1.否2.正在审核3.通过)", dictType="is_pass", align=2, sort=12)
	private String isPass;		// 是否通过(1.否2.正在审核3.通过)
	private List<XsWriterIncome> xsWriterIncomeList = Lists.newArrayList();		// 子表列表

	public XsWriter() {
		super();
		this.setIdType(IDTYPE_AUTO);
	}

	public XsWriter(String id){
		super(id);
	}

	public static XsWriter getValue(String name){
		XsWriter xsWriter = new XsWriter();
		xsWriter.setName(name);
		List<XsWriter> list = SpringContextHolder.getBean(XsWriterMapper.class).findList(xsWriter);
		if(list.size()>0){
			return list.get(0);
		}else{
			return new XsWriter ();
		}
	}
}